package debugs;

import javax.servlet.http.HttpServletResponse;

import helpers.StringHelper;
import models.News;

public class NewsDebug {
	public static void debug(News news) {
		System.out.println("id: " + news.getId());
		System.out.println("url: " + news.getUrl());
		System.out.println("title: " + news.getTitle());
		System.out.println("description: " + news.getDescription());
		System.out.println("source: " + news.getSource());
		System.out.println("labels: " + StringHelper.listToString(news.getLabels(), ", "));
		System.out.println("autoSiteId: " + news.getAutoSiteId());
	}
	
	public static void debugWeb(News news, HttpServletResponse response) {
		try {
			response.getWriter().println("id: " + news.getId());
			response.getWriter().println("<br />");
			response.getWriter().println("url: " + news.getUrl());
			response.getWriter().println("<br />");
			response.getWriter().println("title: " + news.getTitle());
			response.getWriter().println("<br />");
			response.getWriter().println("description: " + news.getDescription());
			response.getWriter().println("<br />");
			response.getWriter().println("source: " + news.getSource());
			response.getWriter().println("<br />");
			response.getWriter().println("labels: " + StringHelper.listToString(news.getLabels(), ", "));
			response.getWriter().println("<br />");
			response.getWriter().println("autoSiteId: " + news.getAutoSiteId());
			response.getWriter().println("<br />");
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
